#include"comm.hpp"
#include"log.hpp"
int main()
{
    //共享内存存在会有段错误?
    // Init it;
    // // 2 打开管道
    // int fd = open(FILENAME, O_RDONLY);
    Log log;
    //创建共享内存
    int shmid = Creatshm();
    //挂接共享内存
    char* file = (char*)shmat(shmid,NULL,0);
    char buffer[SIZE] = {0};
    int cnt = 0;
    char get[2] = {0};
    while(true)
    {
        // int n = read(fd,&get,sizeof(get));
        cout<<"processa已经读到了get: "<<get<<endl;
        // if(n == 0)
        //     break;
        memcpy(buffer,file,SIZE);
        cout<<buffer;
        sleep(1);
    }
    //将共享内存与进程脱离
    int ret = shmdt(file);
    //删除共享内存
    shmctl(shmid,IPC_RMID,NULL);
    return 0;
}